package com.ssh.dao.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.stereotype.Repository;

import com.ssh.dao.ProductDao;
import com.ssh.entity.Product;

@Repository
public class ProductDaoImpl implements ProductDao {

	@Autowired
	private HibernateTemplate ht;

	@SuppressWarnings("unchecked")
	@Override
	public List<Product> findProduct() {
		List<Product> pList = ht.find("from Product");
		
		return pList;
	}

	@SuppressWarnings("unchecked")
	@Override
	public Product show(Integer pid) {
		List<Product> plist = ht.find("from Product where pid=?",pid);
		return plist.get(0);
	}
}
